package com.czq.cn.controller;

import com.czq.cn.entity.SysUser;
import com.czq.cn.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController
{

    @Resource
    private UserService userService;

    @PostMapping("/login")
    public Map<String, String> login(@RequestBody SysUser user){

        try {
            Map<String, String> login = userService.login(user);
            return login;
        }catch (Exception e){
            return new HashMap<>();
        }

    }

}
